/**
 * Copyright (C) 2011 the author
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.linguamathematica.oa4j;

import static java.lang.String.format;

import com.linguamathematica.oa4j.Analysis.Result;

/**
 * The Class DemographicsAnalysis.
 */
public class DemographicsAnalysis
{

	/** The gender. */
	private final Result<Gender> gender;

	/** The education. */
	private final Result<Education> education;

	/** The age. */
	private final Result<Age> age;

	/** The language. */
	private final Result<Language> language;

	/**
	 * Instantiates a new demographics analysis.
	 * 
	 * @param age
	 *            the age
	 * @param gender
	 *            the gender
	 * @param education
	 *            the education
	 * @param language
	 *            the language
	 */
	public DemographicsAnalysis(final Result<Age> age, final Result<Gender> gender, final Result<Education> education,
			final Result<Language> language)
	{
		this.gender = gender;
		this.education = education;
		this.age = age;
		this.language = language;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(final Object obj)
	{
		if (this == obj)
		{
			return true;
		}

		if (obj == null || getClass() != obj.getClass())
		{
			return false;
		}

		final DemographicsAnalysis other = (DemographicsAnalysis) obj;

		return age.equals(other.age) && education.equals(other.education) && gender.equals(other.gender)
				&& language.equals(other.language);
	}

	/**
	 * Gets the age.
	 * 
	 * @return the age
	 */
	public Result<Age> getAge()
	{
		return age;
	}

	/**
	 * Gets the education.
	 * 
	 * @return the education
	 */
	public Result<Education> getEducation()
	{
		return education;
	}

	/**
	 * Gets the gender.
	 * 
	 * @return the gender
	 */
	public Result<Gender> getGender()
	{
		return gender;
	}

	/**
	 * Gets the language.
	 * 
	 * @return the language
	 */
	public Result<Language> getLanguage()
	{
		return language;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode()
	{
		final int prime = 31;
		int result = 1;
		result = prime * result + age.hashCode();
		result = prime * result + education.hashCode();
		result = prime * result + gender.hashCode();
		return prime * result + language.hashCode();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString()
	{
		return format("Demographics Analysis%n gender %s%n education %s%n age %s%n language %s", gender, education,
				age, language);
	}

	/**
	 * The Enum Age.
	 */
	public static enum Age
	{

		/** The YOUNG. */
		YOUNG,
		/** The ADULT. */
		ADULT,
		/** The SENIOR. */
		SENIOR
	}

	/**
	 * The Enum Education.
	 */
	public static enum Education
	{

		/** The UNDECIDED. */
		UNDECIDED,
		/** The PR e_ secondary. */
		PRE_SECONDARY,
		/** The SECONDARY. */
		SECONDARY,
		/** The COLLEGE. */
		COLLEGE,
		/** The POS t_ graduate. */
		POST_GRADUATE;
	}

	/**
	 * The Enum Gender.
	 */
	public static enum Gender
	{

		/** The MALE. */
		MALE,
		/** The FEMALE. */
		FEMALE,
		/** The NEUTRAL. */
		NEUTRAL
	}

	/**
	 * The Enum Language.
	 */
	public static enum Language
	{

		/** The ENGLISH. */
		ENGLISH,
		/** The FRENCH. */
		FRENCH,
		/** The GERMAN. */
		GERMAN,
		/** The ITALIAN. */
		ITALIAN,
		/** The SPANISH. */
		SPANISH,
		/** The SWEDISH. */
		SWEDISH,
		/** The UNKNOWN. */
		UNKNOWN,
		/** The UNDECIDED. */
		UNDECIDED
	}
}
